package com.baor.controller;

import com.baor.domain.ProxyVo;
import com.baor.service.ProxyService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/proxy")
public class ProxyController {

    @Autowired
    private ProxyService proxyService;

    @RequestMapping("/list")
    public AjaxResult<?> list(@RequestBody Map<String, Object> param) {
        return proxyService.list(param);
    }

    @RequestMapping("/search")
    public AjaxResult<?> search(@RequestBody Map<String, Object> param) {
        return proxyService.list(param);
    }

    @RequestMapping("/freeze")
    public AjaxResult<?> freeze(@RequestBody ProxyVo vo) {
        return proxyService.freeze(vo.getProxyId());
    }

    @RequestMapping("/updateLevel")
    public AjaxResult<?> updateLevel(@RequestBody ProxyVo vo) {
        return proxyService.updateLevel(vo);
    }

    @RequestMapping("/distributor")
    public AjaxResult<?> distributor() {
        return proxyService.distributor();
    }

    @RequestMapping("/insert")
    public AjaxResult<?> insert(@RequestBody ProxyVo vo) {
        return proxyService.insert(vo);
    }

    @RequestMapping("/choose")
    public AjaxResult<?> choose(@RequestBody Map<String, Object> param) {
        return proxyService.choose(param);
    }


    @RequestMapping("/levelList")
    public AjaxResult<?> levelList(@RequestBody Map<String, Object> param) {
        return proxyService.levelList(param);
    }


}
